#pragma once
#include "SThread.h"
#include "../SimpleNesCore/Famicom.h"
class FamicomThread :public SThread
{
private:
	HANDLE mClockEvent = nullptr;
	HANDLE mSyncLock = nullptr;
	void* arg = nullptr;
	BOOL loadrom = false;
	Famicom* famicom = nullptr;

public:
	WCHAR filename[1024] = {0};
	FamicomThread(void* arg);


	void WaitSyncLock();
	void ReleaseSyncLock();
	void Play();
	void Pause();
	void Save();
	void Restore();
	void Clock();
	UINT8* GetFrameBuffer();
	void Input(UINT8 index, UINT8 state);
	~FamicomThread();
	BOOL LoadRom(WCHAR* strFilename);
	virtual int Run();
};

